﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using InfoSoftGlobal;
using System.Text;

public partial class ZHCX_KHSFMXB_TX : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {
    if (!Page.IsPostBack)
    {
      if (!ProjectPrivate.GetQX("29"))
      {
        Server.Transfer("~\\blank.aspx");
      }
      DataSet ds = CBSJ.GetYear();
      CommonUse.BindDDL(ds, "year", "year", DateTime.Now.Year.ToString(), ddlYear);
      hlTX.NavigateUrl = "KHSFMXB_TX.aspx?khid=" + CommonUse.GetID("khid");
      hlSJ.NavigateUrl = "KHSFMXB.aspx?khid=" + CommonUse.GetID("khid");
    }
    initData();
  }
  protected void initData()
  {
    DataSet ds = ZHCX.GetCBSF(CommonUse.GetID("khid"), ddlYear.SelectedValue);
    StringBuilder strXML = new StringBuilder();
    StringBuilder strCATE = new StringBuilder();
    StringBuilder strYSSL = new StringBuilder();
    StringBuilder strYSFY = new StringBuilder();
    strXML.Append(@"<graph caption='客户收费明细表' hovercapbg='FFECAA' hovercapborder='F47E00' formatNumberScale='0'
decimalPrecision='0' showvalues='0' numdivlines='3' numVdivlines='0'  labelDisplay='Rotate' slantLabels='1'>");
    strCATE.Append("<categories>");
    strYSSL.Append("<dataset seriesName='实收费用' color='1D8BD1' anchorBorderColor='1D8BD1' anchorBgColor='1D8BD1'>");
    strYSFY.Append("<dataset seriesName='应收费用' color='F1683C' anchorBorderColor='F1683C' anchorBgColor='F1683C'>");
    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
    {
      if (ds.Tables[0].Rows[i]["ssfy"].ToString() == "0.00")
        continue;
      strCATE.Append(" <category name='" + ds.Tables[0].Rows[i]["cbsj"].ToString().Substring(0, 9) + "' />");
      strYSSL.Append("<set value='" + ds.Tables[0].Rows[i]["ssfy"].ToString() + "' />");
      strYSFY.Append("<set value='" + ds.Tables[0].Rows[i]["ysfy"].ToString() + "' />");
    }
    strCATE.Append("</categories>");
    strYSSL.Append("</dataset>");
    strYSFY.Append("</dataset>");
    strXML.Append(strCATE.ToString());
    strXML.Append(strYSSL.ToString());
    strXML.Append(strYSFY.ToString());
    strXML.Append("</graph>");
    ltYJQL.Text = FusionCharts.RenderChartHTML("../FCF/MSColumn2D.swf", "", strXML.ToString(), "myNext", "800", "500", false);
  }
}